<?php
  include("include/config.inc.php");
if(!isset($_SESSION['s_activId']))
{
  $_SESSION['s_urlRedirectDir'] = $_SERVER['REQUEST_URI'];
  header("Location:checkLogin.php");
}
  if(isset($_POST['orderTyoeForm']))
  {
  	$orderType = $_POST['order'];
    $selectOrder = "SELECT party.partyId, party.partyName, party.contact1, bill.billdate
                    FROM party
                    JOIN bill ON party.partyId = bill.partyId
                   ORDER BY partyName";
  }
  $orderArray = array();
  $x = 0;
  $selectOrder = "SELECT party.partyId, party.partyName, party.contact1, bill.billdate
                    FROM party
                    JOIN bill ON party.partyId = bill.partyId
                   ORDER BY partyName";
  $selectOrderRes = mysql_query($selectOrder);
  
  while($orderRow = mysql_fetch_array($selectOrderRes))
  {
    $orderArray[$x]['partyId'] = $orderRow['partyId'];
    $orderArray[$x]['partyName'] = $orderRow['partyName']; 
    $orderArray[$x]['contact1']  = $orderRow['contact1'];
    $orderArray[$x]['billdate']      = $orderRow['billdate'];
    $x++;
  }
  
  include("./bottom.php");
  $smarty->assign('arrayOrder', array(1 => 'Order Aapvaa', 2 => 'Order Levaa', 3 => 'Bill Incoming', 4 => 'Bill Outgoing'));
  $smarty->assign("orderArray",$orderArray);
  $smarty->display("orderlist.tpl");
  
?>